<?php 
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
$sql="select a.*,b.name from ".tablename('wxc_order')." a left join".tablename('wxc_category')." b on a.c_id=b.id where a.id={$_GPC['id']}";

//$list=pdo_fetch($sql);
$info=pdo_fetch($sql);
//$a =array('img'=>$info['thumb']);
$info['img'] = explode(",",$info['thumb']);
print_r(json_encode($info));die;
//
//for($i=0;$i<count($a);$i++){
//    $b['id'] = $a[$i]['img'];
////    print_r(json_encode($b['id']));
//};die;



//print_r(json_encode($info['thumb']));die;
if (checksubmit('submit')) {
    $data['status'] = $_GPC['status'];
//	$data['name'] = $_GPC['name'];
//	$data['thumb'] = $_GPC['thumb'];
//	$data['description'] = html_entity_decode($_GPC['description']);
//	$data['link'] = $_GPC['link'];
//	$data['status'] = $_GPC['status'];
//	$data['create_time'] = date('Y-m-d H:i:s',time());
    $data['uniacid']=$_W['uniacid'];
	if($_GPC['id']==''){  
        $rst=pdo_insert('wxc_order',$data);
        if($rst){
             message('添加成功！', $this->createWebUrl('order'), 'success');
        }else{
             message('添加失败！','','error');
        }
    }else{
         $rst=pdo_update('wxc_order',$data,array('id'=>$_GPC['id']));
        if($rst){
             message('编辑成功！', $this->createWebUrl('order',array('id'=>$info['id'])), 'success');
        }else{
             message('编辑失败！','','error');
        }
    }
}
include $this->template('web/orderdetails');
 ?>